package br.edu.fateczl.view;

import java.awt.Font;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JCheckBox;

public class GUIDevolucao extends JFrame {

	private GUIFundo panPrincipal;
	private JTable tabelaEmprestimos;
	private JTextField tfIDObra;
	private JTextField tfFiltro;
	private JTextField tfDataDevolucao;

	public GUIDevolucao() {
		this.setExtendedState(JFrame.MAXIMIZED_BOTH); 
		setBounds(100, 100, 683, 546);
		panPrincipal = new GUIFundo();
		panPrincipal.setImagem( new ImageIcon(GUIEmprestimo.class
				.getResource("Plano de Fundo.jpg")).getImage() );
		panPrincipal.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(panPrincipal);
		panPrincipal.setLayout(null);

		JLabel lblTipoCliente = new JLabel("Tipo de Cliente:");
		lblTipoCliente.setBounds(444, 91, 106, 14);
		panPrincipal.add(lblTipoCliente);

		JRadioButton rdbtnAluno = new JRadioButton("Aluno(a)");
		rdbtnAluno.setBounds(562, 91, 222, 23);
		panPrincipal.add(rdbtnAluno);

		JRadioButton rdbtnColaborador = new JRadioButton(
				"Colaborador(a) da ETEC/FATEC");
		rdbtnColaborador.setBounds(562, 117, 222, 23);
		panPrincipal.add(rdbtnColaborador);

		JLabel lblSelecaoCliente = new JLabel("Selecione o Cliente:");
		lblSelecaoCliente.setBounds(444, 201, 142, 14);
		panPrincipal.add(lblSelecaoCliente);

		JComboBox cbCliente = new JComboBox();
		cbCliente.setBounds(562, 198, 330, 20);
		panPrincipal.add(cbCliente);

		JLabel lblDevolucao = new JLabel(
				"Devolu\u00E7\u00E3o de Empr\u00E9stimo");
		lblDevolucao.setFont(new Font("Arial", Font.PLAIN, 25));
		lblDevolucao.setBounds(444, 0, 377, 32);
		panPrincipal.add(lblDevolucao);

		JButton btnFiltrarPesquisa = new JButton("Filtrar Pesquisa");
		btnFiltrarPesquisa.setBounds(713, 164, 179, 23);
		panPrincipal.add(btnFiltrarPesquisa);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(560, 236, 402, 23);
		panPrincipal.add(scrollPane);
		
				JTable tbEmprestimos = new JTable();
				scrollPane.setViewportView(tbEmprestimos);
				tbEmprestimos.setModel(new DefaultTableModel(
					new Object[][] {
					},
					new String[] {
						"ID", "Obra", "Data do Empr\u00E9stimo"
					}
				));
				tbEmprestimos.getColumnModel().getColumn(1).setPreferredWidth(181);
				tbEmprestimos.getColumnModel().getColumn(2).setPreferredWidth(110);

		JLabel lblInformeOId = new JLabel("Informe o ID da obra devolvida:");
		lblInformeOId.setBounds(444, 446, 193, 14);
		panPrincipal.add(lblInformeOId);

		tfIDObra = new JTextField();
		tfIDObra.setBounds(640, 443, 252, 20);
		panPrincipal.add(tfIDObra);
		tfIDObra.setColumns(10);

		JButton btnRealizarDevolucao = new JButton("Realizar Devolu\u00E7\u00E3o");
		btnRealizarDevolucao.setBounds(713, 518, 179, 23);
		panPrincipal.add(btnRealizarDevolucao);

		JLabel lblDataDevoluo = new JLabel("Data Devolu\u00E7\u00E3o:");
		lblDataDevoluo.setBounds(444, 471, 118, 14);
		panPrincipal.add(lblDataDevoluo);
		
		tfFiltro = new JTextField();
		tfFiltro.setBounds(562, 165, 86, 20);
		panPrincipal.add(tfFiltro);
		tfFiltro.setColumns(10);
		
		JLabel lblFiltro = new JLabel("Filtrar com Letra: ");
		lblFiltro.setBounds(444, 168, 108, 14);
		panPrincipal.add(lblFiltro);
		
		tfDataDevolucao = new JTextField();
		tfDataDevolucao.setBounds(640, 471, 86, 20);
		panPrincipal.add(tfDataDevolucao);
		tfDataDevolucao.setColumns(10);

	}
	public void limpaCampos() {
		tfIDObra.setText("");
		tfFiltro.setText("");
		tfDataDevolucao.setText("");

	}

}
